Skip to content

CI check: ci/rev349-r4 (scratch, not for merge) - #5

Closed
SetZero wants to merge 458 commits into
masterfrom
ci/rev349-r4
Closed

SetZero wants to merge 458 commits into
masterfrom
ci/rev349-r4

Conversation

@SetZero

@SetZero SetZero commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Runs upstream's CI on this head before it goes to the upstream pull request. Not for merge.

joske and others added 30 commits October 10, 2026 09:28
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…es (move)

Pure move by `tools/split apply tools/split/manifests/platform_2.toml` plus
`cargo +nightly fmt`: phase 2.8 for kms/render/platform.rs. Inherent
`impl PlatformBackend`/helper-type members and free fns go to depth-1
descendant modules (log-target filters on kms::render::platform still
match); each child starts `use super::*;`. Every type and const stays in
the root (private fields stay visible to all children and platform/tests).
7055 lines → platform.rs 741 (imports, all types, consts) + GPU-only
platform/{submit 442, fence 384, storage_alloc 330} + KMS
platform/{connectors 1158, cursor 995, qualify 925, init 874, flip_events
475, scanout_bos 377, power 227, devices 192}.

split verify: 350/350 leaves identical (tokens, effective cfg, comments),
53 manifest visibility changes (private → pub(super); same reach, 32 of
them needed only by platform/tests), 0 audited exceptions, 0 locations,
35 leaves with log calls moved to descendant modules. verify --tests
against the fresh pre-move snapshot: 4008 / 4013 / 4121 tests (default /
tcp-transport / xdmcp) mapped, equal per binary, name and ignored status.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… (move)

Pure move by `tools/split apply tools/split/manifests/scanout_2.toml` plus
`cargo +nightly fmt`: phase 2.7 for kms/vk/scanout.rs. Inherent impls of
the BO, pool and copied-ownership types and free fns go to depth-1
descendant modules (log-target filters on kms::vk::scanout still match);
each child starts `use super::*;`. Every type stays in the root (private
fields stay visible to all children and scanout/tests).
6617 lines → scanout.rs 809 (allocation doc, imports, all types) +
scanout/{copied 1632, probe 819, image_alloc 740, bo 723, bo_pool 498,
modifiers 498, dmabuf_metadata 355, alloc_plan 291, bo_state 241,
errors 63}.

split verify: 376/376 leaves identical (tokens, effective cfg, comments),
105 manifest visibility changes (private → pub(super); same reach, 25 of
them needed only by scanout/tests), 0 audited exceptions, 4 audited
locations (exact_copied_source_plans, probe_directional_modifiers,
probe_dmabuf_scanout_metadata, scanout_modifier_single_plane_supports_feature
call #[track_caller] format queries; only the `asked from file:line` of the
yserver::format_query debug log changes), 22 leaves with log calls moved
to descendant modules. verify --tests against the fresh pre-move
snapshot: 4008 / 4013 / 4121 tests (default / tcp-transport / xdmcp)
mapped, equal per binary, name and ignored status.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…d scanout/ trees

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
libc 0.2.190 removed FreeBSD's NOTE_PCTRLMASK, which nix 0.31.3 still
uses.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e pitch (joske#235)

* docs(kms): plan — pad the copied PRIME transport width

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(kms): copied-pitch plan — review round 1 converged (the copy-region audit is the bounds evidence)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(kms): copied PRIME transport plan — Task 1 keeps the transport in system memory (memory probe); pitch padding becomes Task 2

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(kms): copied PRIME transport plan — review round 2 (the headless two-GPU harness is one disposable attempt with bounded waits)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(kms): copied PRIME transport plan — review round 3 converged; the direction these defects affect

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(kms): copied PRIME transport plan — April's iGPU-to-dGPU direction gets its own test; the APU transport moves to GTT

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(kms): keep the copied PRIME transport in system memory so the sink GPU can read it

The copied (reverse-PRIME) route allocated its DMA-BUF transport in the
renderer's DEVICE_LOCAL memory. When the renderer is a discrete GPU, that is
its own VRAM, which another GPU cannot read without peer access: with an
NVIDIA renderer and an AMD radv sink the sink copy fails with
'amdgpu: Not enough memory for command submission' and VK_ERROR_DEVICE_LOST,
so start-up qualification rejects the route. The transport now prefers a
compatible non-DEVICE_LOCAL (system memory) type; same-device exports keep
DEVICE_LOCAL. On an APU renderer (the iGPU-to-dGPU direction joske#95 was built
for) the transport moves from the carve-out to GTT; both are system RAM.

Tested on an RTX 5060 Ti + Ryzen 7 7700 (radv) host in both directions.

Implemented-By: codex (model gpt-6-luna, reasoning effort xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(kms): pad the copied PRIME transport so linear-pitch sinks can import it

A linear DMA-BUF transport takes the renderer driver's row pitch. NVIDIA
aligns it to 128 bytes, but radv on GFX9+ imports a linear surface only if
its pitch is a multiple of 256 bytes, so the copied route failed at widths
1366, 1440 and 1680 (pitches 5504, 5760 and 6784 bytes):
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT. The transport is now
allocated and imported at the logical width rounded up to 64 BGRA8 pixels
(256 bytes); the render target, every copy region, readback and digest keep
the logical extent, so the padded columns never reach the scanout image.
Widths already a multiple of 64 allocate exactly as before.

Implemented-By: codex (model gpt-6-luna, reasoning effort xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(kms): skip the two-GPU copied PRIME tests when the GPU pair is absent

CI's lavapipe step runs every `#[ignore]`d test on a GPU-less runner, and
these three panicked there for lack of an NVIDIA and an AMD RADV device.
Like the other hardware tests they now skip when the pair is missing; once
both devices are present every failure still fails the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(status): copied PRIME transport entry covers both fixes

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Jos Dehaes <[email protected]>
…bounded extract verifier

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…equests keep the empty write

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ract

split extract generates one fn per listed match arm (or hoists a
dispatcher's fn-local items); verify --extract checks the dispatcher
transformation, call shape, body forms, binding equivalence through a
bounded lexical resolver (refusing unmodelled forms), comments, macro
resolution and the hoist. Fixtures for every modelled binding form.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…als, any mismatch fails

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ps/focus (move)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…itor/xinerama (move)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… and module map

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…randr_ext/ trees

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rpose results as inconclusive

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s proposal

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SetZero and others added 27 commits November 7, 2026 00:10
send_reply_with_fd spun on yield_now until the client's queued output
drained, then sent the reply with one sendmsg and ignored its count. A
client that read slowly held up the core thread, and on a full socket
the rest of the reply was dropped, so the client's stream was torn and
Xlib ended it with "XIO: fatal IO error".

Like Xorg's WriteFdToClient, the descriptor is now queued with the
output: ClientState::outbound_fds keeps a duplicate of it with its
reply's offset and length, and drain_outbound sends that reply alone
with sendmsg and SCM_RIGHTS when it reaches it. The rest goes like any
other output, so nothing waits for the client. On the BSDs, macOS
included, a full peer makes sendmsg with a descriptor fail with
EMSGSIZE instead of EAGAIN; that is would-block too.
A client that selects XI_DeviceChanged on the root window was sent a
"bootstrap" DeviceChanged for each selected master, reason SlaveSwitch,
with the master's class source as its sourceid. On a master no slave
has driven yet that source is the master itself (CorePointerProc's
classes, dix/devices.c:1357,1433), so the event announced a switch to
the master. No X server sends that: Xorg sends no DeviceChanged on
XISelectEvents at all (Xi/xiselectev.c), and its only XISlaveSwitch is
the one dix/getevents.c:699 sends when an event comes from another slave
than the last, naming that slave.

Wine's winex11 trips on it. x11drv_xinput2_init selects DeviceChanged
for XIAllMasterDevices, then asks XIGetClientPointer and XIQueryDevice;
X11DRV_DeviceChanged answers a SlaveSwitch by opening its sourceid with
XOpenDevice to read the device's button map (update_device_mapping).
XOpenDevice of a master is BadDevice, as in Xorg (Xi/opendev.c), and
Wine hands that unexpected error to Xlib's default handler, which ends
the process: every Wine process on a rootless server, before its
first window.

The bootstrap now goes only once a slave has driven the master, and
names that slave, which is what Xorg would have sent at that switch.
A client that selects after the first input (the Cinnamon case it was
added for, aea9b0f, on a server with live devices) is sent it as
before; one that selects before any input is sent nothing, as Xorg
sends nothing, and gets the real SlaveSwitch with the first event.

A test runs Wine's start-up sequence and checks that no event names a
master as its source.
…shClient

The core dropped a client once 4 MiB of its output were queued, a cap
sized to one large QueryFont reply. A game's X client was
dropped that way during start-up ("client 270: output could not be
written (peer gone or 4194304 bytes unread)") and the game exited. Xorg
has no such cap: FlushClient (os/io.c) grows the output buffer while
notWritten + BUFSIZE <= INT_MAX and aborts the client only past that or
when the allocation fails. The cap is INT_MAX now, for a reply that
carries a descriptor as for any other.

The disconnect message printed the cap whatever the cause, so a peer
that had gone looked like a slow reader. The failure now says why where
it happens: the peer gone with its error and the bytes unread, or the cap
with the real count. A backlog is logged when it passes 1 MiB and at each
doubling, with the newest message's kind (reply, error, event code,
GenericEvent extension and type), so the next one shows what the client
was sent while it did not read.

Writes still never wait: a test queues 16 MiB of events for a client
that reads nothing, writes to another client between them, and then
reads all 16 MiB back in order. It fails at the old cap. Tests that
saturate a client use a 4 MiB cap of their thread's own
(client_io::outbound_cap), so they cost what they did.
stays_quiet set SO_RCVTIMEO to wait QUIET for bytes. macOS refuses
that setsockopt with EINVAL once the socket's peer has closed, and a
closed peer is one of the outcomes the helper watches for, so the
quarantine test failed on macOS whenever the server closed first. The
restore after the read already tolerated EINVAL; the first set did not.

The helper now waits with poll(2) for QUIET and reads only once the
socket is readable or hung up, so the read timeout is never touched.
Its verdicts are unchanged: nothing within QUIET, end of file and
ECONNRESET are quiet; a byte is not.
…pha map and clip mask reach the renderer as client XIDs (joske#347)

* fix(render): translate CompositeGlyphs switches and CreatePicture's alpha map and clip mask to backend handles

CompositeGlyphs forwarded its item stream unchanged, and the renderer
read a glyphset switch's value as a key of its own glyphset table, whose
handles are allocated apart from the client's XIDs. A client's switch was
therefore ignored, and its glyphs drawn from the previous glyphset, while
a value equal to some backend handle switched to that glyphset whoever
owned it. Xorg resolves the switch as a GlyphSet XID. The core now
translates each switch to the glyphset's backend handle and sends 0, which
the renderer ignores, for a value that is not a client glyphset.

CreatePicture forwarded its value list unchanged, so its alpha map and
clip mask reached the backend as client XIDs. It now shares
ChangePicture's per-attribute translation; an attribute that does not
resolve is sent as 0 and the picture is still registered, as before.
ChangePicture keeps dropping the whole request on an unresolved attribute.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(render): a glyphset switch is 12 bytes; a switch that is not a GlyphSet is BadGlyphSet

Review on joske#347. A CompositeGlyphs glyphset switch is the 8-byte
xGlyphElt header followed by the 4-byte GlyphSet XID (Xorg
render/render.c), 12 bytes in all. The core translator, the KMS
renderer's parser and the host-X11 command patcher read the XID at
offset 4 of the header (deltax/deltay) and advanced 8 bytes, and the
test fixtures encoded the same layout, so a correctly encoded switch
never reached the renderer as its backend handle. All three now use the
12-byte layout, and the tests encode switches through one helper.

Before forwarding, the core now checks every switch in stream order, as
ProcRenderCompositeGlyphs does: a value that is not a client GlyphSet
answers BadGlyphSet with that value and nothing is drawn. As in Xorg, a
switch whose XID ends exactly at the end of the stream is not looked up.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(host-x11): the glyph command patcher fixture reaches its switch

The fixture's glyph runs lacked their padded payloads, so the walker
never reached the switch element and the test passed with an 8-byte
switch stride too. Both runs now carry their payloads, the switch uses
the shared encoder with a nonzero XID, and the test asserts the switch
comes out unchanged and the run after it is patched at the right offset.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…as a descriptor

DRI3 1.4's explicit sync is built on exporting a syncobj as an opaque
descriptor: Mesa's WSI exports each image's timeline syncobjs so and
imports them into the server with DRI3ImportSyncobj. A render node with
timeline syncobjs that serves sync files only had Mesa choose explicit
sync and then fail to make its swapchain. The node is now probed for
that export at start; without it DRI3 stays at 1.3, with implicit sync,
and Present offers no syncobjs.
…nder node

A server started with no KMS card (a rootless host's, whose window
system owns the display) found no render node, since only a card led to
one, so DRI3 stayed off and X clients' GL and Vulkan could not hand
frames over as dma-bufs. The card-less server now opens a render node of
its own: YSERVER_DRI_RENDER_NODE's, else the render node of the device
its Vulkan device advertises (VK_EXT_physical_device_drm), else the
machine's only one when the device names none.

A software Vulkan device (lavapipe) drives no GPU and gets a render node
only when YSERVER_DRI_RENDER_NODE names one, and only when it can import
dma-bufs (VK_KHR_external_memory_fd): then the clients render on that GPU
and the server imports their LINEAR buffers. Asked for, never guessed.
…aphores

17d29c5 stopped advertising DRI3 fences (Dri3Caps::fence_fd) on a
renderer without VK_KHR_external_semaphore_fd, so that a sync-fd import
or export fails as an error instead of calling an unloaded Vulkan entry
point. The request handler also refused FenceFromFD outright when that
cap is off, with BadImplementation. That was more than the fix needed:
what a client sends with FenceFromFD is Mesa's xshmfence, shared memory
the backend maps and triggers without Vulkan (kms/export.rs tries it
first), and Xorg takes it on every screen (miSyncShmFenceFromFD). Only a
sync_file goes to the Vulkan import, and that already fails as an error
since 17d29c5, which the handler answers with a server-only fence.

On lavapipe, which has no external semaphore fds, every Vulkan swapchain
of Mesa's X11 WSI shares an xshmfence per buffer through FenceFromFD and
waits on it for the buffer to be idle; refused, it waited for ever.
A Proton game on a rootless server whose renderer is lavapipe
showed one frame in five minutes.

FenceFromFD is now taken whatever the cap says; FDFromFence, which
exports a SYNC_FD, stays refused without it, so nothing 17d29c5 fixed
comes back. No path waits on a client's fence on the core thread: an
AwaitFence on it parks the client (sync_await), as before. A test covers
FenceFromFD, FDFromFence and AwaitFence on a renderer without sync-fd
semaphores.
…s Xorg

FenceFromFD made its fence without Xorg's checks (proc_dri3_fence_from_fd,
dri3/dri3_request.c): no LEGAL_NEW_RESOURCE, so a client could name an ID
outside its range or one in use, overwriting another client's fence, and
no drawable lookup. A missing fd was BadAlloc, and a fd the backend could
neither map as an xshmfence nor import as a sync_file still made a
server-only fence, where miSyncShmCreateFenceFromFd answers BadValue when
xshmfence_map_shm fails.

The checks now run in Xorg's order: the length, the new ID (BadIDChoice),
the drawable (BadDrawable), the fd (BadValue). A fd the backend can't take
is BadValue and makes no fence. A test covers each refusal, that none of
them touches the fence already there, and that a destroyed fence's ID can
be taken again.
A rootless host whose window system is a socket the server is a client
of (a Wayland compositor) can serve it on the core thread rather than on
a UI thread of its own: its fd is a backend poll source of a new kind,
BackendFdKind::HostDisplay, and its readiness calls
Backend::on_host_display_ready with the state in hand. A `false` answer
(the window system closed the connection) ends the server as the loss of
its only display would. XBackend hands it to Platform; the default is
a no-op.

Serving it on the core thread keeps the host's events in one order with
the clients' requests and needs no channel or lock between them.
A game that turns the mouse into a direction grabs the pointer to its
window, hides the cursor and warps the pointer back to the window's
centre after each motion. Under a host whose window system moves the
pointer itself that breaks: X's warp moves X's pointer only, the host's
runs into the screen's edge, and the next absolute motion jumps X's
pointer to wherever the host's is.

The core now decides when the host should lock its pointer, starting
from Xwayland's rule (xwl_seat_maybe_lock_on_hidden_cursor,
xwl_seat_emulate_pointer_warp): the displayed cursor is hidden (the None
cursor or XFIXES HideCursor), the host's pointer is on the top-level
(pointer scope), and a grab confines the pointer to it or a WarpPointer
lands inside it. It lets go when the cursor is shown, the pointer
leaves, the grab ends, or, for a lock a warp took, X's pointer leaves
the window. Three parts are ours, not Xwayland's: a fully transparent
cursor image counts as hidden (Backend::displayed_cursor_hidden), which
is how SDL and most games hide it; the host's keyboard must be on the
top-level too (Activated), and its leaving lets go; and a lock a warp
took during a grab goes when the grab ends. Each change is one
RootlessEvent::PointerLock { id } from the reconcile.

While a lock is held the host sends RootlessInput::PointerRelative: X's
pointer moves by the whole pixels of its accelerated delta from where X
has it (which after a game's warp is the centre), the fraction kept for
the next, with the unaccelerated delta as XI2 raw motion. Without a lock
it is dropped.
…'s name

Two things a host needs from the core that the interface lacked.

A host that bridges its window system's clipboard with X's selections
(CLIPBOARD and PRIMARY) needs an X window that owns a selection on the
host's behalf and asks X clients for theirs. Under Xwayland that window
is the compositor's X window manager's (wlroots' xwayland/selection,
Mutter): Xwayland itself bridges no selection. Here the host is that
window manager, so rootless::selection gives it the server's selection
window (a server-owned InputOnly child of the root at a fixed server
XID, made on first use and again after a reset).

The server's SetSelectionOwner, ConvertSelection and SelectionNotify go
through typed entry points, as the spec (§4.4) has internal X actions
do: the request handlers are split into parse and apply, and the server
calls the apply half, so every client hears what another client's
request would make it hear. The server passes every access check, so
the typed calls check what the request would refuse (BadWindow, BadAtom,
and for ChangeProperty BadValue and BadLength, in ProcChangeProperty's
order), and refuse it the same way, changing nothing.

A server window has no connection, so what the protocol would send it
-- the SelectionRequest for a selection it owns, the SelectionClear when
a client takes one from it or the server gives it up (under Xorg's rule,
dix/selection.c:183-191), the SelectionNotify answering its
ConvertSelection, a refusal when nothing owns one, and the
PropertyNotify of its properties and of the client windows the host
watches -- is queued for the host (take_selection_events), and so is the
destruction of a watched window, which ends a transfer to it. That is
all ICCCM's INCR needs in either direction; the transfer itself is the
host's, as it is the window manager's under Xwayland. Only the bridge's
own window, set as an owner by the server, is the host's: the server's
other windows (the window manager's check window, which owns WM_S0)
hear nothing, as a window whose client is gone.

The host also hears who owns the selections it watches
(watch_selection) each time that changes, as a compositor's X window
manager selects XFIXES SelectionNotify: the same hook that fans those
out (Xorg's selection callbacks) queues SelectionEvent::Owner for a
SetSelectionOwner, the server's own included, and for an owner's window
destroyed or its client gone. The host never has to look at the
selections itself.

rootless::name_window_manager names the built-in window manager after
the host's in _NET_WM_NAME of the _NET_SUPPORTING_WM_CHECK window,
rather than "yserver": a client that shows its window manager (Steam's
"X Window Manager") then names the one that really manages its windows.
The name is kept across a server reset.
The presenter was the surface platform's only, and a host there has no
DRI3: the surface platform imports no client buffers. A host whose
window system is a Linux compositor needs the card-less KMS platform
instead, which keeps DRI3 on its renderer's render node, MIT-SHM and
Present for the host's clients.

* The presenter's tick runs on any Platform (it only reads the store,
  the engine and the GPU core, which every platform has).
* rootless::display: a DisplayHost is a RootlessHost served on the core
  thread, whose connection is polled as BackendFdKind::HostDisplay. A
  dispatch collects what the window system said as HostWork, one queue
  of host requests, input and frame events in the order they came,
  which the platform applies in that order once the host is no longer
  borrowed: a key pressed before a focus change in the same read goes to
  the window it was pressed in. Its flush must not block, as nothing on
  the core thread may; what the socket does not take is sent on a later
  iteration.
* kms/rootless.rs: KmsBackend::attach_rootless_host (the root takes the
  host's screen, the keymap its layout) and start_rootless (the core's
  mode, Opaque policy, and the presenter). RandR lists one connected
  output covering the root at the host's refresh, keeps its CRTC
  association across rebuilds, and lists no provider, as Xwayland does
  (a provider that owns no CRTC sent Wine's X driver dividing by a DPI
  of zero).
* rootless::present_clock: that output's Present clock, Xorg's
  present_fake timer at the host's refresh, read on demand and armed for
  parked Present work. The host's frame callbacks do not move it, so a
  client pacing itself by the MSC measures the refresh and not the
  host's latency. The output is never in a scanout blackout.

Nothing attaches a host yet; the Wayland host does.
The core scraps a Present not yet executed when a later one for the same
window and target MSC comes, as Xorg's present_scmd.c does ("don't
bother doing the previous one if this one will overwrite it in the same
frame"). Xwayland scraps no copy there: xwl_present_pixmap executes each
in turn, since the compositor, not the X server, decides which frame a
refresh shows. Its only scrap is a flip queued behind a pending one
(xwl_present_execute's mailbox handling), and a rootless server here
has no flips. A game that presents twice a millisecond apart for the
same MSC lost one of the two: in one such game 32.5 presents a second
came in and the scrap left 19.3 to be shown.

Backend::present_supersedes_same_msc (default true) says whether the
scrap applies. The card-less KMS platform says false while it serves a
rootless host.
…S, Composite, DAMAGE and input operands (joske#343)

* docs(plans): access control PR 3b — RENDER, SHAPE, XFIXES, Composite, DAMAGE, input window operands

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): access control PR 3b — review round 1 (retained cursor identity)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): access control PR 3b — review round 2 (translate RENDER client values to backend handles first)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): access control PR 3b — review round 3 (owner per retained instance; CreatePicture failure contract)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 1: RENDER pictures and drawing

CreatePicture (its drawable, alpha map, clip mask and the new picture),
ChangePicture, SetPictureClipRectangles, FreePicture, Composite,
Trapezoids, Triangles, TriStrip, TriFan, FillRectangles,
SetPictureTransform, QueryFilters, SetPictureFilter, AddTraps and the
four sourceless picture creations ask for their operands. Picture checks
go through verify_pictures!, in argument order; CreatePicture and
ChangePicture share one check of the alpha map and clip mask and keep
their own outcome for an attribute that does not resolve.
RecordingBackend records the RENDER calls these sites make, so a denial
test sees any premature backend effect; the test policies share one
recording and decision path.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 2: RENDER glyphsets and cursors

CreateGlyphSet, ReferenceGlyphSet (the existing glyphset and the new
alias), FreeGlyphSet, AddGlyphs, FreeGlyphs, CompositeGlyphs8/16/32,
CreateCursor and CreateAnimCursor ask for their operands. A glyph
stream's switches are checked as Task 0's translation resolves them, all
before anything is drawn; each animation frame is checked in the
existing per-frame pass, before the cursor is created.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 3: SHAPE

Rectangles, Mask (its destination window and source pixmap), Combine
(source window first, as yserver reads it, then the destination),
Offset, QueryExtents, SelectInput, InputSelected and GetRectangles ask
for their windows. SHAPE validates none of them today, so each is
checked only when its id resolves and an unknown id behaves as before.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 4: XFIXES regions

The region creations (CreateRegion, CreateRegionFromBitmap, FromWindow,
FromGC, FromPicture, and Composite's CreateRegionFromBorderClip) ask for
their operand and the new region; DestroyRegion, SetRegion, CopyRegion,
Union/Intersect/SubtractRegion, InvertRegion, TranslateRegion,
RegionExtents, FetchRegion and ExpandRegion ask for their sources and
destination before anything is written; SetGCClipRegion,
SetWindowShapeRegion and SetPictureClipRegion ask for their target and
region. A destination region that does not exist is not asked and is
created as before. The denial handling is one shared macro,
return_on_access_denial!.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 5: retained cursor identity

A cursor can stay displayed after its XID is freed, and its name keeps
matching. The resource table now records, per host cursor, the XID and
owner it was first bound under (a ChangeCursor alias does not replace
it), until the host cursor is released on the backend on any path:
FreeCursor, a window's cursor change, ChangeCursor's retarget and
disconnect. After an owner disconnects its XID base can be recycled and
another client can create a live cursor with the same number, so the
owner belongs to the instance: ResourceTarget gains owner, None at every
existing site, and policies read AccessContext::target_owner, which
answers it before the live resolver.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 6: XFIXES cursors, windows and barriers

ChangeSaveSet (before the client's save set is borrowed),
SelectSelectionInput, SelectCursorInput, Hide/ShowCursor, Set/
GetCursorName, ChangeCursor, Create/DeletePointerBarrier ask for their
operands. GetCursorImage and GetCursorImageAndName ask for the displayed
cursor through the identity Task 5 records, so a freed but displayed
cursor is still checked with its own owner; a server cursor is not
asked. ChangeCursorByName asks for each cursor that has the name,
retained ones included, and skips a denied one while replacing the rest.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 7: Composite and DAMAGE

RedirectWindow and UnredirectWindow ask for the window, and
RedirectSubwindows and UnredirectSubwindows for the parent and for each
current child, skipping a denied child while the rest and the parent's
rule for future children proceed. NameWindowPixmap and
CreateRegionFromBorderClip ask for the window and the new resource,
Get/ReleaseOverlayWindow for the window they name. DAMAGE Create asks for
the drawable and the new damage, Destroy for the damage, Subtract for the
damage and both regions, and Add for the drawable, the region and each
Damage that would accumulate, skipping a denied one.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3b, Task 8: XInput, XKB and XTEST window, cursor and barrier operands

The window, cursor and barrier operands of the XInput requests
(SelectExtensionEvent, the device grabs and their windows, focus,
dont-propagate lists, XIQueryPointer, XIWarpPointer, XIChangeCursor,
XISelectEvents, XIGetSelectedEvents, XIGrabDevice and the passive grabs,
XISet/GetClientPointer's named resource, XIBarrierReleasePointer's
barriers), XKB Bell's window and XTEST's CompareCursor and FakeInput root
window ask the resource hook; device operands stay for PR 5.
XIBarrierReleasePointer keeps its sequential shape: a denial after
earlier releases reports the policy's error with those releases done.
RecordingBackend records xkb_proxy and query_pointer so a denial test
sees them.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(spec): access control PR 3b denial rows

The denial table gains the 3b derived targets (RedirectSubwindows and
UnredirectSubwindows children, the Damage objects of DAMAGE Add, the
cursors of ChangeCursorByName: skipped, the request succeeds) and
XIBarrierReleasePointer (the policy's error after earlier entries took
effect). "What a policy can see" states that advertised descriptors such
as PictFormats are not checked, and that a cursor still displayed after
its XID was freed keeps its creator's XID and owner until the host
cursor is released.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(core): access control PR 3b — checks right after each operand; one denial path

Final review: verify_pictures! resolved every picture before checking
any, and ChangeCursor validated its destination before checking its
source, so a denied valid operand followed by an invalid one reported the
validity error without asking the policy. Each operand is now checked as
soon as it validates. RENDER and SHAPE use return_on_access_denial!, and
the XInput sites take their opcodes from RequestOpcodes::for_request. The
RENDER denial tests also snapshot damage state, which AddTraps changes
without a renderer call.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(status): access control PR 3b (joske#343)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(status): PR 3b builds on joske#347

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(render): check CompositeGlyphs switches in one stream-order pass

After joske#347, a switch is looked up, checked and translated in one pass
over the item stream: a value that is not a GlyphSet answers
BadGlyphSet, a GlyphSet the policy denies for USE answers the policy's
error, and the first problem wins. Nothing is forwarded on either. As in
joske#347, the pass runs only when the initial glyphset resolves, so with no
policy installed every outcome is joske#347's. joske#347's separate BadGlyphSet
scan is folded into the pass, since a pre-scan would let a later bad
switch beat an earlier denial.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): access control PR 3b review round 1

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(access): one-line rows for the access checks, split by area

Each per-site DENY/ASK row is now one constructor call or table entry of
at most three rustfmt lines (two DAMAGE ASK rows take four to keep their
operands visible), through helpers shared by the file. Assertions are
unchanged: same targets, modes, owners, opcodes, error values and
no-effect checks; 86 tests before and after.

access_resources.rs drops from 5933 to 4150 lines; the colormap and
GC/font/pixmap/cursor groups move whole to access_colormap.rs and
access_gc_font.rs.

Implemented-By: codex (gpt-6-luna xhigh/max)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(access): check order per XLibre at six sites; XISetClientPointer asks MANAGE

Each check now runs right after its own operand's validation, so an
earlier operand's denial wins over a later operand's validity error,
as in XLibre:
- XFIXES ExpandRegion: source READ before the destination lookup;
- XTEST CompareCursor: window GET_ATTR before the cursor lookup;
- XIWarpPointer: destination GET_ATTR before the source window lookup;
- XFIXES SelectSelectionInput / SelectCursorInput: window GET_ATTR
  before the event-mask BadValue;
- Composite Redirect/Unredirect Window/Subwindows: window check before
  the update BadValue and the root BadMatch;
- RENDER CreatePicture: the new picture's CREATE before the alpha map
  and clip mask READ.

XISetClientPointer checks the named resource with MANAGE, as XLibre does;
XIGetClientPointer keeps GET_ATTR.

With no policy installed every outcome is unchanged; each policy row is
paired with a no-policy row.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(access): a retained cursor's record lives until the backend destroys it

The KMS backend keeps a freed cursor while the grab, the root cursor or an
animated cursor still shows it, but the core dropped its ownership record
as soon as no cursor XID or window attribute named it, so an access check
on that cursor found no owner.

Backend gains cursor_alive(host): false by default (the nested backend
destroys a cursor on free_cursor, unchanged), true on KMS while the
cursor's record exists (until collect_released_cursors destroys it), and
settable on RecordingBackend. Each release point sweeps the retained
records and keeps one only while the core references the handle or the
backend reports it alive; the core references are collected once per
sweep. KMS host handles are monotonic and never reused, so a kept record
cannot name another cursor.

With no policy installed nothing a client observes changes.

Implemented-By: codex (gpt-6-luna xhigh)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): XISetClientPointer checks the named resource with MANAGE

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Jos Dehaes <[email protected]>
Direct scanout is per output whatever the other monitors' refresh rates,
and each output enables VRR on its own, several at once, while the
others keep their fixed refresh. The README only mentioned the grouped
case (a window covering every monitor, rates within 0.5%) and VRR on
"the" monitor; the HLD and setup did not say VRR is per output.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…ske#352)

* docs(spec): VRR cursor hold lifts while the direct client is idle

Narrower fix asked on joske#351: VRR unchanged; the cursor rides the direct
owner's frames only while it presented within 100 ms. Measured with a
spike on NVIDIA and AMD.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(spec): VRR cursor idle revision 1.1 — sol review

Stamp only accepted Presents (queue branches, successful submission) via
the backend clock; explicit reset on teardown; Root scope shares one time;
three more mutation tests (queued acceptance renews, cursor commits do not,
pending move across the boundary through next_wakeup); both VRR callers
exercised; existing cursor fixtures install the clock before direct entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): VRR cursor hold lifts while the direct client is idle

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): VRR cursor idle — sol plan review (sequencing, gates, fixtures)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(kms): lift the VRR cursor hold while the direct client is idle

With --vrr, a direct-scanout client that stops presenting left the cursor
hold waiting for frames that never come, so pointer motion went out only
at the 33 ms hold deadline (about 30 Hz) over a still Steam image or a
paused Discord video.

Record when each direct owner's last Present was accepted (queued
successor or a successful immediate submission, on the backend clock),
clear it where the owner slot is cleared, and apply the hold only while
that Present is younger than 100 ms. Only the four cursor callers use the
idle-aware value; VRR selection, the property retry and the gamma path
keep the live wanted state, so VRR_ENABLED commits are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs(status): VRR cursor hold lifts while the direct client is idle

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.1.10 to 1.1.11.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/flate2-rs@1.1.10...v1.1.11)

---
updated-dependencies:
- dependency-name: flate2
  dependency-version: 1.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* docs(spec): solid fills as one instanced draw (joske#155)

Revision 2 after sol review: engine-scoped test observer, session test,
pixel fixtures, scope limited to the RecordedFillRect path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): solid fills as one instanced draw (joske#155)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): instanced solid fill — sol plan review (offset witness, init, nocapture)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(render): draw a solid fill as one instanced draw (joske#155)

RecordedFillRect was emitted with vkCmdClearAttachments, one VkClearRect
per rectangle. hasvk (Ivy Bridge) runs a full BLORP operation per clear
rectangle, and without batch chaining on gen7 it grows one batch buffer
past its 128 MiB pool classes and crashes; the same per-rectangle cost is
the core-font stutter in joske#155.

The fill now uploads its clamped rectangles to the frame's upload arena
as 16-byte instances and draws them with one vkCmdDraw(4, N): a new
instance-rate vertex shader, the existing logic_fill fragment shader and
push layout, and a per-format pipeline without logic op or blending. The
replayed frame's pin set reaches all three emit callers; pipeline,
scissor, push constants and the instance buffer at its offset are set on
every fill. The bottom-left vertex is moved 1/16 px, which keeps
coverage exact and keeps llvmpipe off a rectangle fast path that wrote
zero for a full 1x1 destination.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs(status): solid fills as one instanced draw (joske#155)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(render): drop test-only fill observers from the render path (joske#353 review)

Remove observed_fill_clear_attachments, the per-fill command observer in
emit_fill_draws and the fill_session_steps hook in the replay loop, with
their types and fields. SessionStep's derives go back to master's.

The instanced-fill tests now check from the test side: the recorded
frame (one FillRect with N instances; logic fill then two same-dst fills
for the session case) and the pixels, including the first and last
instances. Mutations run: draw with instance count 1 fails three tests;
binding the instance buffer at offset 0 fails the session test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(render): point the solid-fill vertex bias to the Mesa issue (joske#353 review)

The 1/16 px bias keeps llvmpipe off its linear rasterizer path, which
reads a push constant at a nonzero offset wrongly for a full 1x1
destination. Reproduced outside yserver on Mesa 26.2.5 and filed as
https://gitlab.freedesktop.org/mesa/mesa/-/work_items/16828.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
29ca0fd raised the per-client output cap to INT_MAX, as Xorg's
FlushClient, so a client that stops reading is no longer dropped. The
scenario still required the disconnect and has failed every nightly run
since. It now requires the slow client to stay connected, keep its
window, and receive every event once it reads, besides the healthy
client getting every event and the server staying alive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3, MIT-SHM and GLX (joske#357)

* docs(plan): access control PR 3c-i (SYNC, Present, DRI3, MIT-SHM, GLX)

Sol plan review r1 incorporated: pbuffer backing pixmap checked as its own
kind on create and destroy (B-1); SHM CreatePixmap frees its allocation on a
late segment denial (M-1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): access control PR 3c-i — sol review r2 (Present mixed-failure rows, notify checks before domain selection)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): access control PR 3c-i, Task 1: SYNC counters and priority

CreateCounter asks CREATE before the insert; SetCounter, ChangeCounter
and DestroyCounter ask WRITE/DESTROY after the writable-counter helper;
QueryCounter asks READ (system counters with owner SERVER_OWNER);
SetPriority/GetPriority ask GET_ATTR on a resolving resource.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 2: SYNC alarms and Await

Await checks each condition's counter READ right after its lookup;
CreateAlarm and ChangeAlarm check the attribute counter READ in the
attributes helper, CreateAlarm asks CREATE before the insert; ChangeAlarm,
QueryAlarm and DestroyAlarm ask WRITE/READ/DESTROY after BadAlarm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(core): access control PR 3c-i, Task 2 review: skip the alarm counter check for None

The attribute counter's READ check now runs only for a nonzero counter,
as its existing lookup does; a counter created with XID 0 is no longer
asked for an alarm naming None. Task 2's SYNC tests move to
access_sync.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 3: SYNC fences

CreateFence checks a resolving drawable GET_ATTR and asks CREATE with
that drawable as parent (None when it does not resolve); Trigger/Reset
ask WRITE, DestroyFence DESTROY, QueryFence READ, all after BadFence;
AwaitFence checks each fence READ in its existence pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 4: Present

Pixmap and PixmapSynced check the window, pixmap, regions, CRTC, fences
and syncobjs after their own validation, and each resolving notify
window before the MSC domain is selected; NotifyMSC checks the window;
SelectInput checks a resolving window, an existing selection's WRITE or
a new one's CREATE; QueryCapabilities checks its Window or CRTC target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(core): access control PR 3c-i, Task 4 review: SelectInput's creation parent only for a resolving window

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 5: DRI3

Open, FDFromFence, GetSupportedModifiers and SetDRMDeviceInUse check
their resolving operands; PixmapFromBuffer(s), FenceFromFD and
ImportSyncobj check the drawable/window and ask CREATE before the
backend import; Buffer(s)FromPixmap ask WRITE before the export;
FreeSyncobj asks WRITE between the missing BadValue and the owner
BadAccess. RecordingBackend records the DRI3 calls so denial rows see
a premature backend effect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 6: MIT-SHM

Attach, AttachFd and CreateSegment ask CREATE before the OS attach or
mapping; Detach checks a resolving segment READ; PutImage passes WRITE
and USE to the drawable/GC helper and checks the segment READ;
GetImage checks the segment between its BadValue and the read-only
BadAccess and the drawable before the readback; CreatePixmap asks
CREATE before the backend allocation and frees that allocation if the
later segment check denies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(core): access control PR 3c-i, Task 6 review: shared SHM creation check, logged rollback failure, FD-lifetime test

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 7: GLX contexts and current state

Context creations (CreateContext, CreateNewContext,
CreateContextAttribsARB, SGIX vendor) check a resolving share context
READ and ask CREATE before the insert; DestroyContext asks DESTROY for
a resolving context; IsDirect and QueryContext ask READ; MakeCurrent,
MakeContextCurrent and SwapBuffers check the context USE and their
drawables (GLX drawable WRITE, else core window/pixmap GET_ATTR) when
they resolve. Unsupported requests are not checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(core): access control PR 3c-i, Task 7 review: SwapBuffers checks its drawable, not the context tag

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* feat(core): access control PR 3c-i, Task 8: GLX drawables

GLX pixmap creations check the pixmap ADD and ask CREATE before the
insert; CreateWindow checks a resolving window ADD; CreatePbuffer asks
CREATE for the GLX drawable and for its same-XID backing pixmap before
the record and the allocation; the destroys ask DESTROY for a resolving
GLX drawable, and DestroyPbuffer also for the core pixmap it frees
(skipped on denial, request succeeds); Get/ChangeDrawableAttributes
and Bind/ReleaseTexImageEXT check their drawable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* test(core): access control PR 3c-i, Task 8 review: shared GLX test helpers, export-backed destroy denials

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs: access control PR 3c-i spec rows and status

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* refactor(core): access control PR 3c-i final review: one shared check_resource! / check_creation!

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs(plan): access control PR 3c-i — maintainer review round 1

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): access control PR 3c-i review 1 — sol r1: GLX alias documented, KillClient unchanged

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(core): access control PR 3c-i review: arbitrary-resource operands resolve over every kind

SYNC SetPriority/GetPriority and XISetClientPointer/XIGetClientPointer
look their id up over every resource kind the access layer resolves
(core stores first, then the extension stores), as Xorg's
dixLookupClient does with RC_ANY; an id that resolves to nothing is not
asked. KillClient keeps resource_owner's scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* refactor(core): access control PR 3c-i review: one resolver-based validator for arbitrary-resource operands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(core): access control PR 3c-i review: MakeCurrent's release form checks nothing; drop DestroyPbuffer's derived pixmap check

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs: access control PR 3c-i review round 1 spec notes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…joske#355) (joske#356)

* docs(plan): detectable auto-repeat and XI2 key repeat (joske#355)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): detectable auto-repeat — option A after sol review r1

Keep today's repeat pair; filter the synthetic release per recipient
(flagged core/XI1, all XI2) and mark XI2 repeats. Xorg's single-press
model (B-1, M-1) not adopted; marker carried through Xi1QueuedEvent and
frozen replay (M-2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plan): detectable auto-repeat — sol review r2 (PerClientFlags validates before mutation, Xorg order)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(xkb): honour DetectableAutoRepeat per client (joske#355)

The software auto-repeat keeps its KeyRelease + KeyPress pair through
the same input path, now marked as a synthetic repeat on the key event
and its queued forms (grab owner, XI1 queue, frozen replay). Delivery
omits the synthetic release for each core and XI1 recipient that
enabled DetectableAutoRepeat; every other client gets today's bytes.

PerClientFlags is answered in the core: flags are stored per client,
validated before any change in Xorg's order (size, initialization,
keyboard device, legal change bits, value within change, auto-reset
controls), and reported as stored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(xkb): PerClientFlags accepts every keyboard the server reports (joske#355 review)

The device check resolves numeric ids through the XI registry and the
XKB keyboard id instead of a fixed list; a missing device is BadDevice
and a non-keyboard BadClass, as Xorg. The unflagged-client oracle now
compares full packets against independent expected bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* fix(xi2): mark repeated key presses with XIKeyRepeat (joske#355)

An auto-repeat's synthetic press reaches XI2 recipients with
XIKeyRepeat set, and its synthetic release is not delivered to them, as
Xorg; XI2 still shadows the core form for those clients.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

* docs(status): detectable auto-repeat and XI2 key repeat (joske#355)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implemented-By: codex (gpt-6-luna xhigh)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…utput waits

A rootless host served on the core thread flushes its display connection
without blocking, so a full socket leaves requests queued. The loop
watched that connection for readable alone: with the window system's
socket full and nothing else happening, the next flush never came and
the host stalled.

The loop now watches a host display connection for writable too while
the backend says its last flush left output queued
(Backend::host_display_wants_writable, default false), as it watches a
client's output (watch_writable). Asked after before_block, it
re-registers the fd READABLE | WRITABLE, and READABLE again once
everything is out. The readiness is on_host_display_ready, which
flushes. The poller is edge-triggered, so a socket that drained between
the flush and the re-registration reports at once, and a full one does
not wake the loop until it takes more. Nothing waits on the core thread.

Test: the core loop with a host connection whose socket is full and
output queued sends it all once the peer reads, with nothing else to
wake it, and then sleeps; without the write interest the output never
went out.
…nswer names

A host that asks X owners for a selection through the server's one
selection window could not tell the answer to a request from a late
answer to an earlier one: every request was at CurrentTime, and
SelectionEvent::Notify had the selection, the target and the property
alone. A late refusal names no property at all.

rootless::selection::convert_selection now takes the time to ask with,
which the owner is sent in its SelectionRequest, and
SelectionEvent::Notify has the time the owner answered with: its
request's (ICCCM 2.2). A host that asks each time with a time of its own
knows which request an answer is to, a refusal included. The server's
own refusal, where nothing owns the selection, has the request's time.

Tests: the owner is sent each request's time; the host hears the time an
owner's SelectionNotify has, and the request's time in the server's own
refusal.
With --rootless on a build with the new `wayland` feature (Linux only,
off by default) the server is a client of the Wayland compositor
WAYLAND_DISPLAY names: it owns neither the console nor a card, runs on
the card-less KMS platform (DRI3 on its renderer's render node, Present
on the host output's clock), and each top-level X window becomes an
xdg_toplevel of the compositor's, each override-redirect one an
xdg_popup. It is served on the core thread as a DisplayHost. A build
without the feature refuses --rootless (without --headless) and names
the feature.

The Wayland side is wayland-client on its own Rust implementation of
the wire, not the `system` libwayland backend: the server links no C
Wayland library, and the protocols it speaks beyond the core (xdg-shell,
xdg-output, cursor-shape, relative pointer, pointer constraints,
ext-data-control) come from wayland-protocols, all behind the feature.
wayland/client.rs keeps what the protocol makes a client keep (the
configure handshake, each surface's wl_shm buffers and which the
compositor still reads, the seat's serials and focus, the cursor) and
hands the host the rest as events in the order the compositor sent them,
so a relative motion still comes before the pointer motion it belongs
to.

Nothing on the core thread waits. The connection's descriptor is polled
by the core loop; each readiness flushes without blocking, reads what
the socket holds and dispatches it, and only the connect, at start,
makes round trips. What a flush leaves queued for a full socket goes out
when the socket drains (DisplayHost::unsent, which the loop's write
interest follows). What the host queues between reads (the frame events
of the presenter's tick) the platform takes each loop iteration
(DisplayHost::take_queued), and the pipes of clipboard transfers wake
the loop through a descriptor of the host's (DisplayHost::wake_fd).

This is SetZero's fork's backend ported onto the rootless interface
rather than replayed: its topology diff, popup parent guess, seat
mapping, pointer scope, WM_STATE, EWMH announcement and server-as-client
request helpers are the core's now, and what remains here is the host
(spec §8.2):

* Windows from RootlessEvents: Mapped makes the compositor's window with
  title, app id (WM_CLASS's class), parent (WM_TRANSIENT_FOR) and size
  limits (WM_NORMAL_HINTS) set before the first commit, where a
  compositor decides whether it floats; InfoChanged follows them. What
  an X client sets cannot make the compositor end the connection: a
  title or class ends at a NUL and is cut to fit a Wayland message, size
  limits are clamped (a greatest size below the least is invalid_size),
  and a parent that would close a cycle is refused (invalid_parent).
* Popups: a popup hangs from the core's parent, else the window the
  pointer is on, else the newest, once that window's first frame was
  delivered (a compositor does not show a popup made on an unmapped
  parent), at its outer corner relative to the parent's, anchored there
  with no constraint adjustment so the compositor does not move it.
  ParentChanged makes it again, Configured repositions it
  (xdg_popup.reposition, or made again under the same id before
  xdg_wm_base 3), and one the compositor took away is not made again
  until it unmaps. A surface made again restarts its frames
  (FrameEvent::Recreated): it is drawn whole once it is configured. A
  window the compositor refuses is tried again a second later, not on
  every pass, and so is a frame that could not be drawn.
* The compositor's first configure is SetupDone; a later one with
  another size is HostRequest::Resized, its close CloseRequested, the
  keyboard's enter and leave Activated and Deactivated. A window that
  resized itself keeps that size at a configure that leaves the size to
  it. _NET_WM_MOVERESIZE (WmRequest::BeginMove/BeginResize) is the
  compositor's drag, with the last press's serial. _NET_ACTIVE_WINDOW
  for the window the keyboard is on is granted, as the compositor's XWM
  grants it under Xwayland: the window is activated again, WM_TAKE_FOCUS
  included. Wine asks this after a window of its own closes, and its
  game window took no input until it was answered.
* Pixels: CPU frames from the presenter's asynchronous readback, copied
  straight into a free wl_shm buffer of the window's (XRGB8888 below
  depth 32, premultiplied ARGB8888 at it; one memfd pool per buffer,
  kept until the size changes) and damaged by the presenter's damage
  with damage_buffer; the frame callback is asked for on the commit that
  shows the frame, which paces the window. A top-level is shown without
  its X border, which the compositor's frame takes the place of, as a
  reparenting window manager's would; a popup whole.
* The seat is a slave pointer and a slave keyboard of the core pair,
  "Wayland pointer" and "Wayland keyboard", announced before any input,
  as Xwayland's xwayland-pointer and xwayland-keyboard are; its input
  comes from them (InputOrigin::Physical), so each event names the slave
  as its source and the first switches the master to it. A master as an
  event's source is one no X server sends: Wine opens a raw button's
  source with XOpenDevice, which is BadDevice for a master, and Xlib's
  default handler ends the process. The server makes no libinput
  context (InputSource::HostSeat, at platform init) and starts no input
  thread: the compositor owns the devices. A pointer or keyboard the
  seat loses is released, and made anew when the seat has one again,
  since an object made before the capability came back hears nothing.
* Input: pointer-local input, buttons, the wheel as buttons 4 to 7
  (axis_value120 summed to clicks, else axis_discrete, else ten units a
  click; a wheel's frame is its clicks alone, and one axis event at most
  a hundred), keys as evdev + 8. Every input's time, keys, buttons, the
  wheel, motion and crossings alike, is the server's clock as the event
  is handed to X, in the order the compositor sent them, as Xwayland
  stamps its seat's. The cursor is the X cursor as a wl_shm surface, the
  compositor's arrow (wp_cursor_shape_v1) before the first; and a lock
  of the pointer, which the core decides (RootlessEvent::PointerLock)
  and a persistent zwp_locked_pointer_v1 holds, gives relative motion
  (zwp_relative_pointer_v1) while it is in force.
* The keyboard is the compositor's: its keymap's whole text is the
  server's keymap, read within the descriptor's size and 4 MiB (at
  start too, so a reset keeps it), and wl_keyboard.modifiers is resolved
  on it to X's real modifiers and group and set as the XKB state, told
  as XkbStateNotify, with no key pressed for it. The modifiers that
  follow an enter carry the held keys' state; leaving drops what is
  depressed and latched.
* The clipboard, X's CLIPBOARD and PRIMARY both ways with
  ext_data_control_v1, through the core's selection window; text only,
  no INCR. A paste's pipe blocks only at the other program's end, and
  is watched, not polled. A transfer from an X owner is known by its
  request's time, so a late answer or refusal is not a newer transfer's;
  a late answer's data goes only from the bridge's own property. X owns
  only what the bridge can paste from, something else than text copied
  in a Wayland program leaves X's selection with no owner, at most
  sixteen pastes are under way at once, TIMESTAMP is answered, and a
  server reset starts the bridge again.
* RandR: one output, WAYLAND-1, at the compositor's first screen's
  logical size (zxdg_output_v1's, else its mode over its scale) and
  refresh; the root follows a later change of that size
  (HostRequest::ScreenLayout). The window manager is named after the
  compositor's process (SO_PEERCRED), else YSERVER_WM_NAME.
* A compositor without wl_compositor, wl_shm or xdg_wm_base is refused
  at the connect, by name.

The host is built on Linux alone, with the feature (cfg(wayland_host),
which build.rs sets).

Tests cover the seat (its devices, input times, no libinput, and a
device lost and back, driven on the wire), activation, queued host work
in order, a flush into a full socket, the keyboard's state and keymap,
the presenter's restart, the root following the screen, size limits,
parent cycles, titles, the wheel, and the clipboard's transfers: their
times, late answers, the text types and a reset.
The build-features design has every optional feature named in three
places, and `wayland` was in none of them.

* `yserver --version` lists `wayland` in `features=[...]`, between the
  other two, where the Wayland host is built (the feature, on Linux).
* docs/setup.md lists the feature and how to build with it.
* CI builds, lints and tests `--features wayland` as a fourth leg: no
  other leg compiles src/wayland/ or the cfg(wayland_host) half of the
  rootless code.
@SetZero SetZero closed this Nov 10, 2026
@SetZero
SetZero deleted the ci/rev349-r4 branch November 10, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants